//
//  BLWeatherDetailsButton.m
//  weather
//
//  Created by 大L君的无敌战舰 on 16/4/11.
//  Copyright © 2016年 bigL.com. All rights reserved.
//


#import "BLButtonForWeatherFourthView.h"

@interface BLButtonForWeatherFourthView ()



@end

@implementation BLButtonForWeatherFourthView


- (instancetype)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        //加载子控件
        [self setChildView];
        //加载数据
        [self loadData];
    }
    return self;
}



//加载子控件
-(void)setChildView
{
    
    /* 图标 */
    UIImageView * iconImageView= [[UIImageView alloc]init];
    self.iconImageView = iconImageView;
    [self addSubview:iconImageView];
    //约束
    [iconImageView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self).offset(0);
        make.top.equalTo(self).offset(0);
        make.bottom.equalTo(self).offset(0);
        make.width.mas_equalTo(self.mas_height);
    }];

    
    
    /* 顶部文字 */
    UILabel * topLabel = [[UILabel alloc]init];
    topLabel.font = TextSmallSize;
    self.topLabel = topLabel;
    [self addSubview:topLabel];
    //约束
    [topLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.right.equalTo(self).with.offset(-5);
        make.bottom.equalTo(self.mas_centerY).with.offset(0);
    }];

    /* 底部文字 */
    UILabel * botLabel = [[UILabel alloc]init];
    botLabel.font = TextMinimumSize;
    botLabel.alpha = 0.7;
    self.botLabel = botLabel;
    [self addSubview:botLabel];
    //约束
    [botLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.right.equalTo(self).with.offset(-5);
        make.top.equalTo(self.topLabel.mas_bottom).with.offset(0);
    }];
}


//加载数据
- (void)loadData
{
    self.topLabel.text = @"三月初七";
    self.botLabel.text = @"万年历";
   
    self.topLabel.textColor = [UIColor whiteColor];
    self.botLabel.textColor = [UIColor whiteColor];
    
    self.URL = @"www.baidu.com";
    
    //    self.describe.backgroundColor = BLRandomColor(1);
    //    self.date.backgroundColor     = BLRandomColor(1);
    //    self.temperature.backgroundColor = BLRandomColor(1);
    
    
    self.iconImageView.backgroundColor = BLRandomColor(2);
//    self.forecastImageView.backgroundColor = BLRandomColor(2);
    
    
}
@end
